<template>
  <div class="container">
    <div class="con-left">
      <img :src="singInfo.albumpic"
           alt="">
      <h1>专辑介绍</h1>
      <p>{{singInfo.albuminfo}}</p>
      <div class="download">
        <i class="iconfont icon-xiazai"></i>
        <span>下载这首歌</span>
      </div>
      <div class="down-app">
        <img src="https://h5static.kuwo.cn/www/kw-www/img/qrcode.d53daff.png"
             alt="">
        <span>手机扫描我二维码下载客户端</span>
      </div>
    </div>
    <div class="con-right">
      <div class="header">
        <h2>{{singInfo.name}}</h2>
        <p class="singer">{{singInfo.artist}}</p>
        <div class="title">
          <span>专辑：</span>
          <p class="wrap">{{singInfo.album}}</p>
          <span>发行时间：</span>
          <p class="wrap">{{singInfo.releaseDate}}</p>
        </div>
        <div class="button">
          <button class="playAll"> <i class="iconfont icon-24gl-play" /> 播放全部</button>
          <button class="add"> <i class="iconfont icon-zengjia" /> 添加</button>
          <button class="pinglun"> <i class="iconfont icon-duihuaxinxi" />分享</button>
          <button class="like"> <i class="iconfont icon-aixin" /> 收藏</button>
          <button class="pinglun"> <i class="iconfont icon-duihuaxinxi" /> 评论</button>
        </div>
      </div>
      <div class="singer-content">
        <div class="content-wrap"
             :class="{change: flag === true}">
          <h4>孤勇者，陈奕迅</h4>
          <p v-for="sing in singText.lrclist"
             :key="sing.time">{{sing.lineLyric}}</p>
        </div>
        <span class="close"
              @click="clickHandle">
          {{flag ? '展开': '收起'}}
          <i v-if="flag"
             class="iconfont icon-arrow-down"></i>
          <i v-else
             class="up iconfont icon-arrow-down"></i>
        </span>
      </div>
      <Talking :value="topTalk"/> 
      <Talking :value="talk"/> 
      <div class="new-comment">
      </div>
    </div>
  </div>
</template>

<script>
import { reqGetSingerInfo, reqGetSingerText ,reqGetTopTalk ,reqGetTalk} from '../../api/PlayMusic'
import Talking from './components/Taking.vue'
export default {
  name: 'PlayMusic',
  components: {
    Talking
  },
  data () {
    return {
      mid: '',
      singInfo: {},
      singText: {},
      flag: true,
      topTalk: {},
      talk:{}
    }
  },
  async mounted () {
    this.mid = this.$route.params.mid || '162457325'
    const result = await reqGetSingerInfo(this.mid)
    if (result.code === 200) {
      this.singInfo = result.data
    }
    const result1 = await reqGetSingerText(this.mid)
    if (result1.status === 200) {
      this.singText = result1.data
    }
    const result2 = await reqGetTopTalk(this.mid) 
    if (result2.result === 'ok') {
      this.topTalk = result2
    }
    const result3 = await reqGetTalk(this.mid) 
    if (result3.result === 'ok') {
      this.talk = result3
    }
  },
  methods: {
    clickHandle () {
      this.flag = !this.flag
    }
  }
}
</script>

<style lang="less" scoped>
p {
  margin: 0;
  padding: 0;
}
.container {
  width: 1300px;
  display: flex;
  flex-direction: row;
  .con-left {
    margin-right: 80px;
    width: 22.5%;
    img {
      width: 100%;
    }
    h1 {
      margin-top: 50px;
      font-size: 22px;
    }
    p {
      width: 100%;
      font-size: 14px;
      line-height: 22px;
      max-height: 110px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 5;
      overflow: hidden;
      margin: 20px 0;
    }  
    .download {
      width: 202px;
      font-size: 14px;
      background-color: #ffe443;
      margin-left: 50%;
      transform: translateX(-50%);
      padding: 10px 0;
      border-radius: 20px;
      text-align: center;
      margin-bottom: 30px;
      margin-top: 30px;
      cursor: pointer;
    }
    .down-app {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      border-top: 1px solid #eee;
      img {
        height: 168px;
        width: 168px;
        margin: 36px 0 18px 0;
      }
      span {
        font-size: 16px;
      }
    }
  }
  .con-right {
    width: calc(100% - 22.5% - 50px);
    .header {
      h2 {
        font-size: 30px;
      }
      .singer {
        font-size: 18px;
        padding: 15px 0 15px 0;
      }
      .title {
        display: flex;
        font-size: 14px;
        align-items: center;
        margin-bottom: 40px;
        span {
          color: #999;
        }
        .wrap {
          font-size: 14px;
          margin-right: 30px;
        }
      }
      .button {
        margin-bottom: 25px;
        button {
          font-size: 16px;
          margin-right: 10px;
          cursor: pointer;
          &.playAll {
            width: 150px;
            height: 40px;
            border-radius: 20px;
            border-style: none;
            background-color: #ffe12c;
          }
          &.add,
          &.like,
          &.pinglun {
            width: 118px;
            height: 40px;
            border-radius: 20px;
            border-style: none;
          }
        }
      }
    }
    .singer-content {
      .content-wrap {
        overflow: hidden;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        width: 100%;
        &.change {
          max-height: 429px;
        }
        h4 {
          font-size: 14px;
          font-weight: 700;
        }
        p {
          line-height: 24px;
          font-size: 14px;
          color: #999;
          width: 100%;
        }
      }
      .close {
        color: #296294;
        cursor: pointer;
        font-size: 14px;
        .arrow {
          transform: rotate(180deg);
        }
        i {
          font-size: 20px;
          font-weight: normal;
        }
        .up {
          display: inline-block;
          transform: rotateX(180deg);
        }
      }
    }
  }
}
</style>